﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using IiiToolkitMain.Common;
using IiiToolkitMain.Common.Dto;

namespace IiiToolkitMain
{
    public partial class VideoPtzForm : Form
    {
        private HkAction _hkAction;
        public IntPtr SessionId { get;private set; }
        public string DeviceSerial { get; private set; }
        public int ChannelNo { get; private set; }
        public VideoPtzForm(IntPtr sessionId, HkAction hkAction, string deviceSerial, int channelNo)
        {
            SessionId = sessionId;
            _hkAction = hkAction;
            DeviceSerial = deviceSerial;
            ChannelNo = channelNo;
            InitializeComponent();

            this.videoPtz1.onVideoPtzClick += VideoPtz1_onVideoPtzClick;
        }

        private void VideoPtz1_onVideoPtzClick(object sender, Controls.VideoPtzEventArgs e)
        {
            //SessionId = _hkAction.AllocSession();
            switch (e.Action)
            {
                case HkSDK.PTZAction.START:
                    _hkAction.PtzCtrl_Start(SessionId, DeviceSerial, ChannelNo, e.Command, 2);
                    break;
                case HkSDK.PTZAction.STOP:
                    _hkAction.PtzCtrl_Stop(SessionId, DeviceSerial, ChannelNo);
                    break;
            }
            
        }
    }
}
